﻿using System;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Reflection;
using Gammar.Digger.SystemFramework;
using Gammar.Digger.Entity;
using Gammar.Digger.IDAL;
using Gammar.Digger.Data;
namespace Gammar.Digger.DALSqlServer
{
    public partial class comment_data
    {
        public int Add(comment_dataEntity entity, string tableName)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(string.Format("INSERT INTO {0}(",tableName));
            strSql.Append("comment_id,point,title,detail,author,create_time,data_id)");
            strSql.Append(" VALUES (");
            strSql.Append("@comment_id,@point,@title,@detail,@author,@create_time,@data_id)");
            SqlParameter[] parameters = {
					new SqlParameter("@comment_id",SqlDbType.UniqueIdentifier),
					new SqlParameter("@point",SqlDbType.Int),
					new SqlParameter("@title",SqlDbType.VarChar),
					new SqlParameter("@detail",SqlDbType.Text),
					new SqlParameter("@author",SqlDbType.VarChar),
					new SqlParameter("@create_time",SqlDbType.BigInt),
					new SqlParameter("@data_id",SqlDbType.UniqueIdentifier)
					};
            parameters[0].Value = entity.comment_id;
            parameters[1].Value = entity.point;
            parameters[2].Value = entity.title;
            parameters[3].Value = entity.detail;
            parameters[4].Value = entity.author;
            parameters[5].Value = entity.create_time;
            parameters[6].Value = entity.data_id;

            return helper.ExecuteNonQuery(strSql.ToString(), parameters);
        }
    }
}
